import moment from 'moment';
// 命名规范：Arr普通枚举  field下拉字段枚举  Map表格字段枚举

// 表头筛选字段
const headerForm = {};
// 表格字段
const tableColumn = {
  // 表格列表
  albumTableMap: [
    {
      prop: 'id',
      type: 'text',
      label: 'ID',
    },
    {
      prop: 'userId',
      type: 'text',
      label: '用户ID',
    },
    {
      prop: 'albumImage',
      type: 'image',
      label: '照片',
    },
    {
      prop: 'albumTitle',
      type: 'text',
      label: '照片标题',
    },
    {
      prop: 'albumStatus',
      type: 'text',
      label: '状态',
      optionKey: 'COVERT_STATUS',
    },
    {
      prop: 'auditStatus',
      type: 'text',
      label: '审核状态',
      optionKey: 'APPROVE_STATUS',
    },
    {
      prop: 'replyContent',
      type: 'text',
      label: '驳回原因',
    },
  ],
};
// 表单字段
const editForm = {
  // 筛选表单
  albumFilterMap: [
    {
      prop: 'nickname',
      type: 'input',
      label: '昵称',
      clearable: true,
      col: 0,
    },
    {
      prop: 'realName',
      type: 'input',
      label: '真实姓名',
      clearable: true,
      col: 0,
    },
    {
      prop: 'userId',
      type: 'select',
      label: '用户名或编号',
      clearable: true,
      optionDynamic: {
        apiKey: 'UserIdOption',
        params: {},
        methods: 'get',
      },
      optionValue: 'id',
      optionLabel: 'username',
      col: 0,
    },
    {
      prop: 'auditStatus',
      type: 'select',
      label: '状态',
      clearable: true,
      filterable: true,
      optionKey: 'APPROVE_STATUS',
      col: 0,
    },
    {
      prop: 'auditTimeStartTime',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      label: '加入开始时间',
      clearable: true,
      col: 0,
    },
    {
      prop: 'auditTimeEndTime',
      label: '加入结束时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
  ],
  // 新增/修改表单
  albumFormMap: [
    {
      prop: 'userId',
      type: 'select',
      label: '用户ID',
      clearable: true,
      optionDynamic: {
        apiKey: 'UserIdOption',
        params: {},
        methods: 'get',
      },
      optionValue: 'id',
      optionLabel: 'username',
      col: 24,
    },
    {
      prop: 'createBy',
      type: 'input',
      label: '创建人',
      clearable: true,
      disabled: true,
      col: 24,
    },
    {
      prop: 'albumTitle',
      type: 'input',
      label: '照片标题',
      clearable: true,
      col: 24,
    },
    {
      prop: 'albumImage',
      type: 'upload',
      label: '照片',
      clearable: true,
      col: 24,
      plusStyle: { width: '200px', height: '200px', fontSize: '50px' },
      imageStyle: { width: '200px', height: '200px', display: 'block' },
    },
    {
      prop: 'albumStatus',
      type: 'radio',
      label: '状态',
      optionKey: 'COVERT_STATUS',
      col: 24,
    },
    {
      prop: 'auditStatus',
      type: 'radio',
      label: '审核状态',
      optionKey: 'APPROVE_STATUS',
      col: 24,
    },
    {
      prop: 'replyContent',
      type: 'textarea',
      label: '驳回原因',
      row: 5,
      clearable: true,
      col: 24,
    },
  ],
};
// 其他映射
const otherMap = {};
// 表单字段校验
const editRule = {
  albumFormRule: {
    userId: [{ required: true, message: '用户ID不能为空', trigger: 'blur' }],
    createBy: [{ required: true, message: '创建人不能为空', trigger: 'blur' }],
    albumTitle: [{ required: true, message: '照片标题不能为空', trigger: 'blur' }],
    albumImage: [{ required: true, message: '请上传照片', trigger: 'change' }],
    albumStatus: [{ required: true, message: '请选择状态', trigger: 'change' }],
    auditStatus: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
    replyContent: [{ required: true, message: '驳回原因不能为空', trigger: 'blur' }],
  },
};
export default {
  headerForm,
  tableColumn,
  editForm,
  otherMap,
  editRule,
};
